#!/usr/bin/make -f
# -*- makefile -*-
include /usr/share/dpkg/default.mk

CONFFLAGS = \
	--with-boost-libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
	--with-bashcompletiondir=$(shell pkg-config --variable=completionsdir bash-completion) \
	--with-zshcompletiondir=/usr/share/zsh/vendor-completions

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# export DEB_BUILD_MAINT_OPTIONS=hardening=-all
export DEB_CFLAGS_MAINT_APPEND=-I/usr/include/tizonia

# This is a workaround to avoid gcc running out of memory in i386 and armhf archs
ifeq ($(DEB_HOST_ARCH),i386)
	export DEB_CXXFLAGS_MAINT_SET=-I/usr/include/tizonia -O2 -s -DNDEBUG -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
else
	ifeq ($(DEB_HOST_ARCH),armhf)
		export DEB_CXXFLAGS_MAINT_SET=-I/usr/include/tizonia -O2 -s -DNDEBUG -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
	else
		export DEB_CXXFLAGS_MAINT_SET=-I/usr/include/tizonia -g -O0 -s -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
	endif
endif

%:
	dh $@  --with autoreconf,bash-completion

override_dh_auto_configure:
	dh_auto_configure -- $(CONFFLAGS)

override_dh_strip:
	dh_strip --dbg-package=tizonia-player-dbg
